package linker

import "rvld/src/utils"

// private
func getEntryAddr(ctx *Context) uint64 {
	for _, osec := range ctx.OutputSections {
		if osec.Name == ".text" {
			//.text means code space ?
			return osec.Shdr.Addr
		}
	}

	return 0
}

func getFlags(ctx *Context) uint32 {
	utils.ThisAssert(len(ctx.Objs) > 0)
	flags := ctx.Objs[0].GetEhdr().Flags

	for _, obj := range ctx.Objs[1:] {
		if obj.GetEhdr().Flags&EF_RISCV_RVC != 0 {
			flags |= EF_RISCV_RVC
			break
		}
	}

	return flags
}

// DONE
